package com.sg.service.biz.calc.impl;

import com.sg.common.util.RedisUtil;
import com.sg.dto.biz.calc.req.ImplementParentSubMidCycleTypeComReqDto;
import com.sg.dto.biz.calc.req.ImplementReceiveFieldReqDto;
import com.sg.dto.biz.calc.res.ImplementParentSubMidCycleTypeComRespDto;
import com.sg.dto.biz.calc.res.ImplementReceiveFieldRespDto;
import com.sg.dto.integration.component.ImplementDebugBusinessDataRedisComReqDto;
import com.sg.dto.integration.component.ImplementDebugBusinessDataRedisComRespDto;
import com.sg.common.exception.Assert;
import com.wicket.okrcomponent.integration.FwCompBusinessAtomClient;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * @author ：
 * @version 1.0
 * @date ：
 */
@Service
public class TargetCycleServiceImpl
        implements com.wicket.okrcalc.biz.service.TargetCycleService {

    @Resource
    private RedisUtil redisUtil;
    //@Resource
    //private MCustomFieldsService mCustomFieldsService;
    @Resource
    private NbTargetCycle nbTargetCycle;
    @Resource
    private FwCompBusinessAtomClient fwCompBusinessAtomClient;
//@Resource
    //private MCustomFields3Service mCustomFields3Service;

    /**
     * D4-执行父子中周期类型分析[5997]
     * gen by moon at 6/20/2024, 6:29:08 PM
     */
    @Trace(operationName = "D4-执行父子中周期类型分析")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Transactional(rollbackFor = Exception.class)
    @Override
    public ImplementParentSubMidCycleTypeComRespDto implementParentSubMidCycleTypeCom(ImplementParentSubMidCycleTypeComReqDto reqDto) {


        ImplementReceiveFieldRespDto receptionServiceRes_3 = null;
        if ((reqDto != null && reqDto.getIsProcessCycleStage() != null && reqDto.getIsProcessCycleStage().equals("FALSE") && reqDto != null && reqDto.getIsFatherCycle() != null && reqDto.getIsFatherCycle().equals("TRUE") && reqDto != null && reqDto.getIsSubCycle() != null && reqDto.getIsSubCycle().equals("FALSE") && reqDto != null && reqDto.getIsMetaphase() != null && reqDto.getIsMetaphase().equals("FALSE")) || (reqDto != null && reqDto.getIsProcessCycleStage() != null && reqDto.getIsProcessCycleStage().equals("FALSE") && reqDto != null && reqDto.getIsFatherCycle() != null && reqDto.getIsFatherCycle().equals("TRUE") && reqDto != null && reqDto.getIsMetaphase() != null && reqDto.getIsMetaphase().equals("TRUE") && reqDto != null && reqDto.getIsSubCycle() != null && reqDto.getIsSubCycle().equals("FALSE")) || (reqDto != null && reqDto.getIsProcessCycleStage() != null && reqDto.getIsProcessCycleStage().equals("FALSE") && reqDto != null && reqDto.getIsFatherCycle() != null && reqDto.getIsFatherCycle().equals("TRUE") && reqDto != null && reqDto.getIsMetaphase() != null && reqDto.getIsMetaphase().equals("FALSE") && reqDto != null && reqDto.getIsSubCycle() != null && reqDto.getIsSubCycle().equals("TRUE")) || (reqDto != null && reqDto.getIsProcessCycleStage() != null && reqDto.getIsProcessCycleStage().equals("FALSE") && reqDto != null && reqDto.getIsFatherCycle() != null && reqDto.getIsFatherCycle().equals("TRUE") && reqDto != null && reqDto.getIsMetaphase() != null && reqDto.getIsMetaphase().equals("TRUE") && reqDto != null && reqDto.getIsSubCycle() != null && reqDto.getIsSubCycle().equals("TRUE"))) {
            //if((D4-执行父子中周期类型分析.是否过程周期阶段 等于 否 and D4-执行父子中周期类型分析.是否父周期 等于 是 and D4-执行父子中周期类型分析.是否子周期 等于 否 and D4-执行父子中周期类型分析.是否中期 等于 否) or (D4-执行父子中周期类型分析.是否过程周期阶段 等于 否 and D4-执行父子中周期类型分析.是否父周期 等于 是 and D4-执行父子中周期类型分析.是否中期 等于 是 and D4-执行父子中周期类型分析.是否子周期 等于 否) or (D4-执行父子中周期类型分析.是否过程周期阶段 等于 否 and D4-执行父子中周期类型分析.是否父周期 等于 是 and D4-执行父子中周期类型分析.是否中期 等于 否 and D4-执行父子中周期类型分析.是否子周期 等于 是) or (D4-执行父子中周期类型分析.是否过程周期阶段 等于 否 and D4-执行父子中周期类型分析.是否父周期 等于 是 and D4-执行父子中周期类型分析.是否中期 等于 是 and D4-执行父子中周期类型分析.是否子周期 等于 是))  31493

//ModelCode: receptionService
            ImplementReceiveFieldRespDto receptionServiceRes = null;
            ImplementReceiveFieldReqDto receptionServiceReq = new ImplementReceiveFieldReqDto();
            receptionServiceReq.setParentSubMidCycleType("PARENT_CYCLE");//sourceId:712939_1_31494

            /*约定：父周期[2950]  用于特殊方法接收上游入参。 */
            Assert.isNull(receptionServiceReq.getParentSubMidCycleType(), "D4-执行父子中周期类型分析-约定：父周期-父子中周期类型不能为空", false);
            receptionServiceRes = nbTargetCycle.implementReceiveField(receptionServiceReq);


//ModelCode: receptionService
            ImplementReceiveFieldRespDto receptionServiceRes_2 = null;
            ImplementReceiveFieldReqDto receptionServiceReq_1 = new ImplementReceiveFieldReqDto();
            if (receptionServiceRes != null) {
                receptionServiceReq_1.setParentSubMidCycleType(receptionServiceRes.getParentSubMidCycleType());//SimpleFieldAssign//sourceId:712847_1_31495
            }

            /*约定出参：父子中周期类型[2950]  用于特殊方法接收上游入参。 */
            Assert.isNull(receptionServiceReq_1.getParentSubMidCycleType(), "D4-执行父子中周期类型分析-约定出参：父子中周期类型-父子中周期类型不能为空", false);
            receptionServiceRes_2 = nbTargetCycle.implementReceiveField(receptionServiceReq_1);


            receptionServiceRes_3 = receptionServiceRes_2;
        } else if ((reqDto != null && reqDto.getIsFatherCycle() != null && reqDto.getIsFatherCycle().equals("FALSE") && reqDto != null && reqDto.getIsMetaphase() != null && reqDto.getIsMetaphase().equals("TRUE") && reqDto != null && reqDto.getIsSubCycle() != null && reqDto.getIsSubCycle().equals("FALSE") && reqDto != null && reqDto.getIsProcessCycleStage() != null && reqDto.getIsProcessCycleStage().equals("FALSE")) ||
                (reqDto != null && reqDto.getIsFatherCycle() != null && reqDto.getIsFatherCycle().equals("FALSE") && reqDto != null && reqDto.getIsMetaphase() != null && reqDto.getIsMetaphase().equals("TRUE") && reqDto != null && reqDto.getIsSubCycle() != null && reqDto.getIsSubCycle().equals("TRUE") && reqDto != null && reqDto.getIsProcessCycleStage() != null && reqDto.getIsProcessCycleStage().equals("FALSE"))) {
            //elseif((D4-执行父子中周期类型分析.是否父周期 等于 否 and D4-执行父子中周期类型分析.是否中期 等于 是 and D4-执行父子中周期类型分析.是否子周期 等于 否 and D4-执行父子中周期类型分析.是否过程周期阶段 等于 否))  31496

//ModelCode: receptionService
            ImplementReceiveFieldRespDto receptionServiceRes_4 = null;
            ImplementReceiveFieldReqDto receptionServiceReq_2 = new ImplementReceiveFieldReqDto();
            receptionServiceReq_2.setParentSubMidCycleType("MID_CYCLE");//sourceId:712862_1_31497

            /*约定：中期[2950]  用于特殊方法接收上游入参。 */
            Assert.isNull(receptionServiceReq_2.getParentSubMidCycleType(), "D4-执行父子中周期类型分析-约定：中期-父子中周期类型不能为空", false);
            receptionServiceRes_4 = nbTargetCycle.implementReceiveField(receptionServiceReq_2);


//ModelCode: receptionService
            ImplementReceiveFieldRespDto receptionServiceRes_6 = null;
            ImplementReceiveFieldReqDto receptionServiceReq_3 = new ImplementReceiveFieldReqDto();
            if (receptionServiceRes_4 != null) {
                receptionServiceReq_3.setParentSubMidCycleType(receptionServiceRes_4.getParentSubMidCycleType());//SimpleFieldAssign//sourceId:712847_1_31498
            }

            /*约定出参：父子中周期类型[2950]  用于特殊方法接收上游入参。 */
            Assert.isNull(receptionServiceReq_3.getParentSubMidCycleType(), "D4-执行父子中周期类型分析-约定出参：父子中周期类型-父子中周期类型不能为空", false);
            receptionServiceRes_6 = nbTargetCycle.implementReceiveField(receptionServiceReq_3);


            receptionServiceRes_3 = receptionServiceRes_6;
        } else if ((reqDto != null && reqDto.getIsFatherCycle() != null && reqDto.getIsFatherCycle().equals("FALSE") && reqDto != null && reqDto.getIsMetaphase() != null && reqDto.getIsMetaphase().equals("FALSE") && reqDto != null && reqDto.getIsSubCycle() != null && reqDto.getIsSubCycle().equals("TRUE") && reqDto != null && reqDto.getIsProcessCycleStage() != null && reqDto.getIsProcessCycleStage().equals("FALSE"))) {
            //elseif((D4-执行父子中周期类型分析.是否父周期 等于 否 and D4-执行父子中周期类型分析.是否中期 等于 否 and D4-执行父子中周期类型分析.是否子周期 等于 是 and D4-执行父子中周期类型分析.是否过程周期阶段 等于 否))  31499

//ModelCode: receptionService
            ImplementReceiveFieldRespDto receptionServiceRes_7 = null;
            ImplementReceiveFieldReqDto receptionServiceReq_4 = new ImplementReceiveFieldReqDto();
            receptionServiceReq_4.setParentSubMidCycleType("SUB_CYCLE");//sourceId:712855_1_31500

            /*约定：子周期[2950]  用于特殊方法接收上游入参。 */
            Assert.isNull(receptionServiceReq_4.getParentSubMidCycleType(), "D4-执行父子中周期类型分析-约定：子周期-父子中周期类型不能为空", false);
            receptionServiceRes_7 = nbTargetCycle.implementReceiveField(receptionServiceReq_4);


//ModelCode: receptionService
            ImplementReceiveFieldRespDto receptionServiceRes_9 = null;
            ImplementReceiveFieldReqDto receptionServiceReq_5 = new ImplementReceiveFieldReqDto();
            if (receptionServiceRes_7 != null) {
                receptionServiceReq_5.setParentSubMidCycleType(receptionServiceRes_7.getParentSubMidCycleType());//SimpleFieldAssign//sourceId:712847_1_31501
            }

            /*约定出参：父子中周期类型[2950]  用于特殊方法接收上游入参。 */
            Assert.isNull(receptionServiceReq_5.getParentSubMidCycleType(), "D4-执行父子中周期类型分析-约定出参：父子中周期类型-父子中周期类型不能为空", false);
            receptionServiceRes_9 = nbTargetCycle.implementReceiveField(receptionServiceReq_5);


            receptionServiceRes_3 = receptionServiceRes_9;
        } else if ((reqDto != null && reqDto.getIsProcessCycleStage() != null && reqDto.getIsProcessCycleStage().equals("TRUE"))) {
            //elseif(D4-执行父子中周期类型分析.是否过程周期阶段 等于 是)  36712

//ModelCode: receptionService
            ImplementReceiveFieldRespDto receptionServiceRes_10 = null;
            ImplementReceiveFieldReqDto receptionServiceReq_6 = new ImplementReceiveFieldReqDto();
            receptionServiceReq_6.setParentSubMidCycleType("PROCESS_CYCLE");//sourceId:822142_1_36768

            /*约定：过程周期[2950]  用于特殊方法接收上游入参。 */
            Assert.isNull(receptionServiceReq_6.getParentSubMidCycleType(), "D4-执行父子中周期类型分析-约定：过程周期-父子中周期类型不能为空", false);
            receptionServiceRes_10 = nbTargetCycle.implementReceiveField(receptionServiceReq_6);


//ModelCode: receptionService
            ImplementReceiveFieldRespDto receptionServiceRes_12 = null;
            ImplementReceiveFieldReqDto receptionServiceReq_7 = new ImplementReceiveFieldReqDto();
            if (receptionServiceRes_10 != null) {
                receptionServiceReq_7.setParentSubMidCycleType(receptionServiceRes_10.getParentSubMidCycleType());//SimpleFieldAssign//sourceId:712847_1_36714
            }

            /*约定出参：父子中周期类型[2950]  用于特殊方法接收上游入参。 */
            Assert.isNull(receptionServiceReq_7.getParentSubMidCycleType(), "D4-执行父子中周期类型分析-约定出参：父子中周期类型-父子中周期类型不能为空", false);
            receptionServiceRes_12 = nbTargetCycle.implementReceiveField(receptionServiceReq_7);


            receptionServiceRes_3 = receptionServiceRes_12;
        } else {
            //else  69890

            ImplementDebugBusinessDataRedisComRespDto implementDebugBusinessDataRedisComRespDto = null;
            ImplementDebugBusinessDataRedisComReqDto implementDebugBusinessDataRedisComReqDto = new ImplementDebugBusinessDataRedisComReqDto();
            implementDebugBusinessDataRedisComReqDto.setBusinessDataObject("BUSINESS_DATA_OBJECT_TEST");//sourceId:1863274_1_69891
            implementDebugBusinessDataRedisComReqDto.setDebugScene("SINGLE_OBJECT");//CUSTOM_CONVENTION//sourceId:1863287_1_69891
            implementDebugBusinessDataRedisComReqDto.setWrongObjectDescribe("对不起，执行周期父子中周期类型分析错误~");//CUSTOM_CONVENTION//sourceId:1863288_1_69891
            if (reqDto != null) {
                implementDebugBusinessDataRedisComReqDto.setCustomField9(reqDto.getExecuteCycleStageId());//SimpleFieldAssign//sourceId:1863298_1_69891
            }

            /*D2执行DEBUG业务对象数据Redis(公共)[9660]   */
            Assert.isNull(implementDebugBusinessDataRedisComReqDto.getBusinessDataObject(), "D4-执行父子中周期类型分析-D2执行DEBUG业务对象数据Redis(公共)-业务数据对象不能为空", false);
            Assert.isNull(implementDebugBusinessDataRedisComReqDto.getDebugScene(), "D4-执行父子中周期类型分析-D2执行DEBUG业务对象数据Redis(公共)-DEBUG业务场景不能为空", false);
            Assert.isNull(implementDebugBusinessDataRedisComReqDto.getWrongObjectDescribe(), "D4-执行父子中周期类型分析-D2执行DEBUG业务对象数据Redis(公共)-错误对象描述不能为空", false);
            implementDebugBusinessDataRedisComRespDto = fwCompBusinessAtomClient.implementDebugBusinessDataRedisCom(implementDebugBusinessDataRedisComReqDto).getData()/*vcase invoke 跨dubbo调用;*/;


        }
        ImplementParentSubMidCycleTypeComRespDto retData = new ImplementParentSubMidCycleTypeComRespDto();
        if (receptionServiceRes_3 != null) {
            retData.setParentSubMidCycleType(receptionServiceRes_3.getParentSubMidCycleType());//SimpleFieldAssign//sourceId:747650_1
        }


        return retData;
    }
    //
}
